package ru.nsu.fit.iconveyor.conveyor.storage.importer.graphml.elements;

import java.util.Stack;

/**
 * @author Timur Zolotuhin (tzolotuhin@gmail.com)
 */
public class GraphMLGraph {
	private final String id;
	private final Stack<GraphMLVertex> vertices;
    private final Stack<GraphMLEdge> edges;
    private final Stack<GraphMLAttribute> attributes;
    private final boolean directed;

    public GraphMLGraph(String id, boolean directed) {
		this.id = id;
		this.directed = directed;
		this.vertices = new Stack<GraphMLVertex>();
        this.edges = new Stack<GraphMLEdge>();
        this.attributes = new Stack<GraphMLAttribute>();
	}

	public GraphMLVertex addVertex(String id) {
        GraphMLVertex v = new GraphMLVertex(id);
		vertices.add(v);
        return v;
	}

    public GraphMLEdge addEdge(String id, String srcId, String trgId) {
        GraphMLEdge e = new GraphMLEdge(id, srcId, trgId);
        edges.add(e);
        return e;
    }

	public String getId() {
		return id;
	}

	public boolean isDirected() {
		return directed;
	}

	public Stack<GraphMLVertex> getVertices() {
		return vertices;
	}

    public Stack<GraphMLEdge> getEdges() {
        return edges;
    }

    public Stack<GraphMLAttribute> getAttributes() {
        return attributes;
    }
}
